package router

import (
	"api_gateway/handler/api"
	"api_gateway/until"
	"github.com/gin-gonic/gin"
)

func Router(r *gin.Engine) {
	r.Use(until.Cors())
	v1 := r.Group("/v1")
	{
		
		user := v1.Group("/user")
		{
			user.POST("/sendSms", api.SendSms)     //发送验证码
			user.POST("/register", api.Register)   //注册
			user.POST("/login", api.Login)         //登录
			user.POST("/checkUser", api.CheckUser) //切换司机
		}
		driver := v1.Group("/driver")
		{
			driver.POST("/addDriver", api.AddDriver)                 //添加司机
			driver.POST("/checkDirverStatus", api.CheckDirverStatus) //审核司机
		}
		car := v1.Group("/car")
		{
			car.POST("/brandDirverCar", api.BrandDirverCar) //绑定车辆
			car.GET("/carList", api.CarList)                //车型列表
		}
		order := v1.Group("/order")
		{
			order.POST("/createOrder", api.CreateOrder) //创建订单
			order.POST("/update", api.Update)           //修改订单状态
			order.GET("/detailOrder", api.DetailOrder)  //订单详情
			order.GET("/myOrderList", api.MyOrderList)  //我的订单

		}
		chat := v1.Group("/chat")
		{
			chat.GET("/ws", api.Chat) //websocket
		}
		//aliPay := v1.Group("alipay")
		//{
		//	aliPay.POST("/alipay", api.AliPay) //异步处理
		//}
	}
}
